<script setup>
import {getList} from "./api/index.js";
import {onMounted,ref} from "vue";
import router from '../../../router/index'
let movieList=ref(null)
 const getAll=async ()=>{
   movieList.value= await getList("")
}
onMounted(getAll)
const toDetail=(id)=>{
 if(id){
  //跳转到影片详情页
  router.push({ name: 'MovieDetail', params: { id } }); 
 }
}
</script>

<template>
  <!-- 正在热映区域 -->
  <h2 class="hitMovie">
    正在热映(22部)
    <a href="#">
      全部
      <img src="/img/right-sanjiao.png" alt="" />
    </a>
  </h2>
  <div class="one fudiv">
    <div class="movie" @click="toDetail(movie.id)" v-for="movie in movieList" :key="movie.id" >
      <img :src="movie.imgUrl" alt="" />
      <div class="movieId">
        <p>{{movie.movieName}}</p>
        <i>{{movie.mark}}</i>
      </div>
      <div class="text">购票</div>
      <div v-if="movie.isPre==1 " class="bigLable"></div>
      <div v-else class="smallLable"></div>
    </div>
  </div>
</template>

<style scoped>

</style>